import pytest
from UI_web_A3mall.Page.Pagecsh import Page3
from UI_web_A3mall.data.Faker import generate_phone
from UI_web_A3mall.Tools.Tools import log
from selenium import webdriver

# 定义参数化的场景列表（示例：不同用户类型 + 随机手机号）
scenarios = [
    ("普通用户", generate_phone()),
    ("会员用户", generate_phone()),
    ("管理员", generate_phone()),
]

@pytest.fixture
def driver():
    driver = webdriver.Edge()
    log()
    yield driver
    driver.quit()

@pytest.mark.parametrize("user_type, phone", scenarios)
def test_03(driver,user_type, phone):
    try:
        print(f"用户类型：{user_type}，手机号：{phone}")
        po = Page3(driver)
        po.luoji_03(phone)
    except Exception as p:
        print(p)

if __name__ == '__main__':
    pytest.main(['-s'])